﻿using Dsl.Ped.AddIn.Java.Generated;

namespace Dsl.Ped.AddIn.Java.Helpers
{
    /// <summary>
    /// Helper methods of the <see cref="Constructor"/>
    /// </summary>
    public static class ConstructorHelper
    {
        /// <summary>
        /// Converts the <see cref="Constructor"/> object to its plain text representation
        /// </summary>
        /// <param name="javaConstructor">
        /// <see cref="Constructor"/> object to be converted into a plain text
        /// </param>
        /// <param name="className">Name of the constructor's class</param>
        /// <param name="tabsCount">The tabs Count representing an indent</param>
        /// <returns>String representing a <see cref="javaConstructor"/> converted to a plain text</returns>
        public static string ToPlainText(this Constructor javaConstructor, string className, int tabsCount)
        {
            string tabs = new string('\t', tabsCount);

            var constructorStr = tabs + className + "(" + javaConstructor.parameters.ToPlainText(0) + ") {\r\n" + tabs + "}\r\n";
            return constructorStr;
        }
    }
}
